Method of reducing latency in a flexible parser and an apparatus thereof

ABSTRACT

Embodiments of the apparatus for reducing latency in a flexible parser relate to an implementation that optimizes each parser engine within the parser. A packet enters the parser. Each of the parser engines processes the packet if processing is required. Otherwise, the parser engine simply forwards the packet through without processing the packet, thereby reducing latency. Each parser engine includes a memory. The memory stores bypass data and status information that indicates whether parsing for this packet is completed and, thus, no further processing is required by subsequent parser engines. Each parser engine also includes a counter, which is incremented whenever a packet enters the parser engine and is decremented whenever a packet exists the parser engine. A packet bypasses the parser engine based on the counter of the parser engine and the status information of that packet.

FIELD OF INVENTION

The present invention relates to network packets. In particular, the present invention relates to a method of reducing latency in a flexible parser and an apparatus thereof.

BACKGROUND OF THE INVENTION

FIG. 1 illustrates a block diagram of a parser 100. As shown in FIG. 1, the parser 100 includes N parser engines 105 placed in series. The N parser engines 105 placed in series allows the parser 100 to parse at a high line rate. A network packet entering the parser 100 is processed by each of the N parser engines 105. Each parser engine 105 has some latency through it. Thus, if each parser engine 105 has a latency of T cycles, there is the total latency N*T clocks through the parser 100. Each network packet that goes through the parser 100 will incur this fixed latency. However, in networking, not all packets require all the processing that is provided by the multiple parser engines 105.

BRIEF SUMMARY OF THE INVENTION

Embodiments of the apparatus for reducing latency in a flexible parser relate to an implementation that optimizes each parser engine within the parser. A packet enters the parser. Each of the parser engines processes the packet if processing is required. Otherwise, the parser engine simply forwards the packet through without processing the packet, thereby reducing latency. Each parser engine includes a memory. The memory stores bypass data and status information that indicates whether parsing for this packet is completed and, thus, no further processing is required by subsequent parser engines. Each parser engine also includes a counter, which is incremented whenever a packet enters the parser engine and is decremented whenever a packet exists the parser engine. A packet bypasses the parser engine based on the counter of the parser engine and the status information of that packet.

In one aspect, a method of implementing a parser engine is provided. The method includes receiving data, wherein the data includes an incoming packet and status information regarding the incoming packet, and determining whether the status information indicates a first status. In some embodiments, the first status is parsing completed.

The method also includes, based on the determination that the status information indicates the first status, transmitting the data via a first route of the parser engine when the parser engine is not currently processing one or more other packets. In some embodiments, the first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.

In some embodiments, the method also includes based on the determination that the status information indicates the first status, waiting to transmit the data via the first route of the parser engine when the parser engine is currently processing one or more other packets.

In some embodiments, the method also includes based on the determination that the status information does not indicate the first status, transmitting the incoming packet via a second route of the parser engine. In some embodiments, the second route is a processing route to process the incoming packet. In some embodiments, the method also includes updating the status information after the parser engine processes the incoming packet.

In some embodiments, the method also includes maintaining a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine. In some embodiments, the counter is used to determine whether the parser engine is busy processing other packets.

In another aspect, a method of implementing a parser engine is provided. The method includes maintaining a counter per source port and receiving data, wherein the data includes an incoming packet and status information regarding the incoming packet.

The method also includes determining whether the status information indicates a first status. In some embodiments, the first status is parsing completed.

The method also includes based on the determination that the status information indicates the first status, transmitting the data via a first route of the parser engine when the parser engine is not currently processing one or more other packets that are also identified with a same port as the incoming packet is identified with. In some embodiments, the first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.

In some embodiments, the method also includes based on the determination that the status information indicates the first status, waiting to transmit the data via the first route of the parser engine when the parser engine is currently processing one or more other packets that are also identified with a same port as the incoming packet is identified with.

In some embodiments, the method also includes based on the determination that the status information does not indicate the first status, transmitting the incoming packet via a second route of the parser engine. In some embodiments, the second route is a processing route to process the incoming packet. In some embodiments, the method also includes, prior to transmitting the incoming packet via the second route, incrementing the counter associated with the source port that the incoming packet is identified with. In some embodiments, the method also includes, after transmitting the incoming packet via the second route, determining whether parsing of the incoming packet is completed and decrementing the counter associated with the source port that the incoming packet is identified with.

In yet another aspect, a method of a parser is provided. The parser includes a plurality of parser engines in a series. The method includes sending data through each of the plurality of parser engines, wherein the data includes an incoming packet and status information of the incoming packet.

The method also includes each of the plurality of parser engines determining whether to send the data through the parser engine based on a first event and a second event occurring. In some embodiments, the first event is processing completed, and the second event is the parser engine is currently not busy processing one or more other packets

The method also includes each of the plurality of parser engines determining whether to process the incoming packet based on a third event occurring. In some embodiments, the third event is processing incomplete.

In some embodiments, the method also includes each of the plurality of parser engines maintaining a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine.

In some embodiments, the method also includes each of the plurality of parser engines maintaining a counter per source port, wherein the counter associated with the source port is incremented each time a packet that is identified with source port enters the parser engine and is decremented each time a packet that is identified with source port exits the parser engine.

In yet another aspect, a parser is provided. The parser includes a plurality of parser engines. In some embodiments, each of the parser engines is stateless. Typically, each parser engine includes a processing route, wherein the processing route processes incoming packets, and a bypass route, wherein the bypass route sends incoming packets through the parser engine without being processed by the parser engine. An incoming packet entering the parser engine is transmitted via the processing route or the bypass route depending a status of the incoming packet and a status of the parsing engine.

In some embodiments, when the status of the incoming packet is parsing incomplete, the incoming packet is transmitted via the processing route and the status is thereafter updated.

In some embodiments, when the status of the incoming packet is parsing complete and the status of the parsing engine is not currently processing one or more other packets, the incoming packet is transmitted via the bypass route.

In some embodiments, when the status of the incoming packet is parsing complete and the status of the parsing engine is currently processing one or more other packets, the incoming packet is transmitted via the bypass route after the parser engine is finished processing the one or more other packets.

In some embodiments, when the status of the incoming packet is parsing completed and the status of the parsing engine is not currently processing one or more other packets that are identified with a same source port as the incoming packet is identified with, the incoming packet is transmitted via the bypass route.

In some embodiments, when the status of the incoming packet is parsing completed and the status of the parsing engine is currently processing one or more other packets that are identified with a same source port as the incoming packet is identified with, the incoming packet is transmitted via the bypass route after the parser engine is finished processing the one or more other packets.

In some embodiments, each parser engine also includes a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine. Alternatively, each parser engine also includes a counter per port, wherein the counter is incremented each time a packet that is identified with the associated port enters the parser engine and is decremented each time a packet that is identified with the associated exits the parser engine.

In yet another aspect, a parser is provided. The parser includes a plurality of parser engines. Typically, each parser engine includes memory, wherein the memory stores bypass information of packets. Each parser engine also includes at least one counter to keep track of a number of packets currently being processed by the parser engine. Each parser engine also includes a processing route, wherein the processing route processes packets. Each parser engine also includes a bypass route, wherein the bypass route sends packets through the parser engine without being processed by the parser engine, wherein a packet entering the parser engine is transmitted via the processing route or the bypass route depending a status of the packet and a status of the parsing engine. In some embodiments, the status of the parsing engine depends on the at least one counter.

In some embodiments, the bypass route is formed by a TCAM and a SRAM, wherein the SRAM stores bypass data and the status of the packet.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing will be apparent from the following more particular description of example embodiments of the invention, as illustrated in the accompanying drawings in which like reference characters refer to the same parts throughout the different views. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating embodiments of the present invention.

FIG. 1 illustrates a block diagram of a parser.

FIG. 2 illustrates a block diagram of an exemplary parser in accordance with some embodiments of the present invention.

FIG. 3 illustrates a block diagram of a parser engine in accordance with some embodiments of the present invention.

FIG. 4 illustrates a method of a parser engine in accordance with some embodiments of the present invention.

FIG. 5 illustrates another method of the parser engine in accordance with some embodiments of the present invention.

FIG. 6 illustrates a method of a parser in accordance with some embodiments of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

In the following description, numerous details are set forth for purposes of explanation. However, one of ordinary skill in the art will realize that the invention can be practiced without the use of these specific details. Thus, the present invention is not intended to be limited to the embodiments shown but is to be accorded the widest scope consistent with the principles and features described herein.

Embodiments of the apparatus for reducing latency in a flexible parser relate to an implementation that optimizes each parser engine within the parser. A packet enters the parser. Each of the parser engines processes the packet if processing is required. Otherwise, the parser engine simply forwards the packet through without processing the packet, thereby reducing latency. Each parser engine includes a memory. The memory stores bypass data and status information that indicates whether parsing for this packet is completed and, thus, no further processing is required by subsequent parser engines. Each parser engine also includes a counter, which is incremented whenever a packet enters the parser engine and is decremented whenever a packet exists the parser engine. A packet bypasses the parser engine based on the counter of the parser engine and the status information of that packet.

A network device, such as a network switch, is able to switch/route network traffic. The network switch includes at least one input/incoming port and at least one output/outgoing port for receiving and transmitting packets. In some embodiments, the network switch also includes a parser and a rewriter. The parser can include one or more parser engines to identify contents of network packets, and the rewriter can include one or more rewrite engines to modify packets before they are transmitted out from the network switch. The parser engine(s) and the rewrite engine(s) are flexible and operate on a programmable basis.

FIG. 2 illustrates a block diagram of an exemplary parser 200 in accordance with some embodiments of the present invention. Briefly, the parser 200 typically uses a combination of TCAM (ternary content addressable memory) and memories, such as SRAM (static random access memory) to identify, to look up fields in a packet.

The parser 200 includes a plurality of parser engines 205 in a series. The plurality of parser engines 205 includes at least one SKPU 205 a and a plurality of KPUs 205 b. In some embodiments, each of the parser engines 205 is stateless.

In some embodiments, incoming data to the parser 200 is from an input mapping, while outgoing data from the parser 200 is to a layer-extraction mapping. In some embodiments, the input mapping maps a network stream to a parser. In some embodiments, the layer extraction mapping is used by other hardware engines of the network switch.

FIG. 3 illustrates a block diagram of a parser engine 300 in accordance with some embodiments of the present invention. In some embodiments, each of the parser engines 205 of FIG. 2 is similarly configured as the parser engine 300. The parser engine 300 includes a processing path, which has eight clocks of latency, although there may be more or less clocks of latency, depending on hardware constraints and requirements. The parser engine 300 includes a bypass path that is formed by a TCAM 305 and a SRAM 310. Within the parser engine 300, the SRAM 310 stores bypass data and status information of a packet. The status information indicates whether parsing for this packet is completed and, thus, no further processing is required by subsequent parser engines.

The parser engine 300 also includes a counter. The counter is incremented whenever a packet enters the parser engine and is decremented whenever a packet exists the parser engine. An exemplary pseudo-code for this counter is shown in Table 1.

TABLE 1 If (packet_enter) curCnt ++; if (packet_exit) curCnt −−; The packet count and the status information (e.g., whether parsing is done) from the previous stage are both used to bypass the parser engine 300, which is reflected in an exemplary pseudo-code shown in Table 2.

TABLE 2 if (packet_enter && (curCnt == 0) && packet_parsing_done) output_packet = input_packet;

FIG. 4 illustrates a method 400 of the parser engine in accordance with some embodiments of the present invention. At a step 405, data is received. The data includes an incoming packet and status information regarding the incoming packet. The status information typically indicates whether parsing of the incoming packet is completed.

At a step 410, it is determined whether the status information indicates a first status. The first status is parsing completed or done from the previous stage.

At a step 415, based on the determination that the status information indicates the first status, the data is transmitted via a first route of the parser engine when the parser engine is not currently processing one or more other packets. In some embodiments, a counter is maintained. The counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine. In some embodiments, the counter is used to determine whether the parser engine is busy processing other packets. In some embodiments, the first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.

Based on the determination that the status information indicates the first status, when the parser engine is currently processing one or more other packets, the data is transmitted via the first route of the parser engine after the parser engine is finished processing the one or more other packets.

Based on the determination that the status information does not indicate the first status, the incoming data is transmitted via a second route of the parser engine. The second route is a processing route to process the incoming packet. The status information is updated after the parser engine processes the incoming packet.

In some embodiments, the parser is able to handle multiple source ports. A slightly more costly implementation, yet more effective, is to maintain a counter per source port rather than a single counter for all source ports. Since there are no constraints on reordering of packets across source ports, this implementation allows the parser engine to be bypassed even if that parser engine is processing packets from other unrelated ports, which is reflected in an exemplary pseudo-code shown in Table 3.

TABLE 3 If (packet_enter) curCnt[port] ++; if (packet_exit curCnt[port] −−; if (packet_enter && (curCnt[port] == 0) && packet_parsing_done) output_packet = input_packet;

FIG. 5 illustrates another method 500 of the parser engine in accordance with some embodiments of the present invention. At a step 505, a counter per source port is maintained.

At a step 510, data is received. The data includes an incoming packet and information regarding the incoming packet. The information includes status information regarding the incoming packet. The status information indicates whether parsing is completed or done from the previous stage.

At a step 515, it is determined whether the status information indicates a first status. The first status is parsing completed.

At a step 520, based on the determination that the status information indicates the first status, the data is transmitted via a first route of the parser engine when the parser engine is not currently processing one or more other packets that are also identified with a same port as the incoming packet is identified with. In some embodiments, the counter associated with the source port that the incoming packet is identified with is used to determine whether the parser engine is busy processing other packets that are identified with the source port. The first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.

Based on the determination that the status information indicates the first status, when the parser engine is currently processing one or more other packets that are also identified with the same port as the incoming packet is identified with, the data is transmitted via the first route of the parser engine after the parser engine is finished processing the one or more other packets.

Based on the determination that the status information does not indicate the first status, the incoming packet is transmitted via a second route of the parser engine. The second route is a processing route to process the incoming packet. Prior to transmitting the incoming packet via the second route, the counter associated with the source port that the incoming packet is identified with is incremented. After transmitting the incoming data via the second route, it is determined whether parsing of the incoming packet is completed and the counter associated with the source port that the incoming packet is identified with is decremented.

FIG. 6 illustrates a method 600 of the parser in accordance with some embodiments of the present invention. The parser includes a plurality of parser engines in a series. At a step 605, data is sent through each of the plurality of parser engines. The data typically includes an incoming packet and status information of the incoming packet.

At a step 610, each of the plurality of parser engines determines whether to send the data through the parser engine based on a first event and a second event occurring. The first event is processing completed and the second event is the parser engine is currently not busy processing one or more other packets.

At a step 615, each of the plurality of parser engines determines whether to process the incoming packet based on a third event occurring. The third event is processing incomplete.

In some embodiments, each of the plurality of parser engines maintains a counter. The counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine. Alternatively, each of the plurality of parser engines maintains a counter per source port. The counter associated with the source port is incremented each time a packet that is identified with source port enters the parser engine and is decremented each time a packet that is identified with source port exits the parser engine. In some embodiments, the second event is determined based on the counter.

One of ordinary skill in the art will realize other uses and advantages also exist. While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. Thus, one of ordinary skill in the art will understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims. 

We claim:
 1. A method of implementing a parser engine, the method comprising: receiving data, wherein the data includes an incoming packet and status information regarding the incoming packet; determining whether the status information indicates a first status; and based on the determination that the status information indicates the first status, transmitting the data via a first route of the parser engine when the parser engine is not currently processing one or more other packets.
 2. The method of claim 1, wherein the first status is parsing completed.
 3. The method of claim 1, wherein the first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.
 4. The method of claim 1, further comprising based on the determination that the status information indicates the first status, waiting to transmit the data via the first route of the parser engine when the parser engine is currently processing one or more other packets.
 5. The method of claim 1, further comprising based on the determination that the status information does not indicate the first status, transmitting the incoming packet via a second route of the parser engine.
 6. The method of claim 5, wherein the second route is a processing route to process the incoming packet.
 7. The method of claim 5, further comprising updating the status information after the parser engine processes the incoming packet.
 8. The method of claim 1, further comprising maintaining a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine.
 9. The method of claim 8, wherein the counter is used to determine whether the parser engine is busy processing other packets.
 10. A method of implementing a parser engine, the method comprising: maintaining a counter per source port; receiving data, wherein the data includes an incoming packet and status information regarding the incoming packet; determining whether the status information indicates a first status; and based on the determination that the status information indicates the first status, transmitting the data via a first route of the parser engine when the parser engine is not currently processing one or more other packets that are also identified with a same port as the incoming packet is identified with.
 11. The method of claim 10, wherein the first status is parsing completed.
 12. The method of claim 10, wherein the first route is a bypass route to send the incoming packet through the parser engine without being processed by the parser engine.
 13. The method of claim 10, further comprising based on the determination that the status information indicates the first status, waiting to transmit the data via the first route of the parser engine when the parser engine is currently processing one or more other packets that are also identified with a same port as the incoming packet is identified with.
 14. The method of claim 10, further comprising based on the determination that the status information does not indicate the first status, transmitting the incoming packet via a second route of the parser engine.
 15. The method of claim 14, wherein the second route is a processing route to process the incoming packet.
 16. The method of claim 14, further comprising, prior to transmitting the incoming packet via the second route, incrementing the counter associated with the source port that the incoming packet is identified with.
 17. The method of claim 14, further comprising, after transmitting the incoming packet via the second route, determining whether parsing of the incoming packet is completed and decrementing the counter associated with the source port that the incoming packet is identified with.
 18. A method of a parser including a plurality of parser engines in a series, the method comprising: sending data through each of the plurality of parser engines, wherein the data includes an incoming packet and status information of the incoming packet; each of the plurality of parser engines determining whether to send the data through the parser engine based on a first event and a second event occurring; and each of the plurality of parser engines determining whether to process the incoming packet based on a third event occurring.
 19. The method of claim 18, wherein the first event is processing completed, the second event is the parser engine is currently not busy processing one or more other packets, and the third event is processing incomplete.
 20. The method of claim 18, further comprising each of the plurality of parser engines maintaining a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine.
 21. The method of claim 18, further comprising each of the plurality of parser engines maintaining a counter per source port, wherein the counter associated with the source port is incremented each time a packet that is identified with source port enters the parser engine and is decremented each time a packet that is identified with source port exits the parser engine.
 22. A parser comprising a plurality of parser engines, wherein each parser engine includes: a processing route, wherein the processing route processes incoming packets; and a bypass route, wherein the bypass route sends incoming packets through the parser engine without being processed by the parser engine, wherein an incoming packet entering the parser engine is transmitted via the processing route or the bypass route depending a status of the incoming packet and a status of the parsing engine.
 23. The parser of claim 22, wherein each of the parser engines is stateless.
 24. The parser of claim 22, wherein when the status of the incoming packet is parsing incomplete, the incoming packet is transmitted via the processing route and the status is thereafter updated.
 25. The parser of claim 22, wherein when the status of the incoming packet is parsing complete and the status of the parsing engine is not currently processing one or more other packets, the incoming packet is transmitted via the bypass route.
 26. The parser of claim 22, wherein when the status of the incoming packet is parsing complete and the status of the parsing engine is currently processing one or more other packets, the incoming packet is transmitted via the bypass route after the parser engine is finished processing the one or more other packets.
 27. The parser of claim 22, wherein when the status of the incoming packet is parsing completed and the status of the parsing engine is not currently processing one or more other packets that are identified with a same source port as the incoming packet is identified with, the incoming packet is transmitted via the bypass route.
 28. The parser of claim 22, wherein when the status of the incoming packet is parsing completed and the status of the parsing engine is currently processing one or more other packets that are identified with a same source port as the incoming packet is identified with, the incoming packet is transmitted via the bypass route after the parser engine is finished processing the one or more other packets.
 29. The parser of claim 22, wherein each parser engine also includes a counter, wherein the counter is incremented each time a packet enters the parser engine and is decremented each time a packet exits the parser engine.
 30. The parser of claim 22, wherein each parser engine also includes a counter per port, wherein the counter is incremented each time a packet that is identified with the associated port enters the parser engine and is decremented each time a packet that is identified with the associated exits the parser engine.
 31. A parser comprising a plurality of parser engines, wherein each parser engine includes: memory, wherein the memory stores bypass information of packets; at least one counter to keep track of a number of packets currently being processed by the parser engine; a processing route, wherein the processing route processes packets; and a bypass route, wherein the bypass route sends packets through the parser engine without being processed by the parser engine, wherein a packet entering the parser engine is transmitted via the processing route or the bypass route depending a status of the packet and a status of the parsing engine.
 32. The parser of claim 31, wherein the status of the parsing engine depends on the at least one counter.
 33. The parser of claim 31, wherein the bypass route is formed by a TCAM and a SRAM, wherein the SRAM stores bypass data and the status of the packet. 